package StudyCode.summary.zipfile;

import java.io.IOException;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class GetCompressionMethodOfZipEntry {
	public static void main(String args[]) {
		try {
			ZipFile zipFile = new ZipFile("E:/Copy/1.zip");

			Enumeration e = zipFile.entries();
			while (e.hasMoreElements()) {
				ZipEntry entry = (ZipEntry) e.nextElement();
				int method = entry.getMethod();

				if (method == ZipEntry.DEFLATED)
					System.out.println(entry.getName() + "\t\t\t\tDeflated");
				else if (method == ZipEntry.STORED)
					System.out.println(entry.getName() + "\t\t\t\tStored");
				else if (method == -1)
					System.out.println(entry.getName() + "\t\t\t\tNot Specified");

			}
			zipFile.close();

		} catch (IOException ioe) {
			ioe.printStackTrace();
		}
	}
}
